package com.orhon.smartcampus.modules.material.inputMapper;

import java.util.Map;

import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.basicComponents.ConvertHelper;
import com.orhon.smartcampus.modules.material.gqlInputModel.GQLBuildingInput;

@Mapper(uses = {
        ConvertHelper.class
})
public interface BuildingInputMapper {

    BuildingInputMapper MAPPER = Mappers.getMapper(BuildingInputMapper.class);

    default GQLBuildingInput mapInput(final Map map){
        String json = JSON.toJSONString(map);
        GQLBuildingInput input = JSON.parseObject(json , GQLBuildingInput.class);
        return input;
    }
}
